package com.aspose.cells;

class zat implements zafn {
   private zig b;
   private int c;
   private Color d;
   private zvi e;
   private Color f;
   private int g;
   private boolean h;
   boolean a;
   private Object i;
   private boolean j = true;
   private boolean k = false;

   zat(zig var1, Object var2, int var3) {
      this.b = var1;
      this.i = var2;
      this.c = var3;
      this.f = Color.getEmpty();
      this.d = Color.getEmpty();
      this.h = false;
      this.a = true;
      this.g = 1;
      this.e = new zvi(this);
   }

   int a() {
      return this.c;
   }

   public boolean b() {
      return this.h;
   }

   public void a(boolean var1) {
      this.h = var1;
      this.a = false;
   }

   public Color c() {
      return this.g == 0 ? Color.getEmpty() : this.d;
   }

   public void a(Color var1) {
      this.d = var1;
   }

   zvi e() {
      return this.e;
   }

   public zagr d() {
      return this.e;
   }

   public Color f() {
      return this.g == 0 ? Color.getEmpty() : this.f;
   }

   public void b(Color var1) {
      this.f = var1;
   }

   public int h() {
      return this.g;
   }

   public void a(int var1) {
      this.g = var1;
   }

   boolean g() {
      return this.g == 3 || this.g == 5 || this.g == 4;
   }

   boolean i() {
      if (this.g()) {
         return false;
      } else if (this.g == 0) {
         return true;
      } else {
         return (this.f.getA() & 255) <= 250;
      }
   }

   public boolean a(zat var1) throws Exception {
      if (!this.g() && !var1.g()) {
         if (this.h() != var1.h()) {
            return false;
         } else if (!this.c().equals(var1.c())) {
            return false;
         } else {
            return this.f().equals(var1.f());
         }
      } else if (this.g() != var1.g()) {
         return false;
      } else {
         return this.e().a(var1.e());
      }
   }

   void c(Color var1) {
      if (this.g == 1) {
         this.b(var1);
      }

   }

   void j() {
      if (this.g == 1) {
         if (this.j) {
            Color var1 = this.b.Z().a().a("dk1");
            int var2;
            switch(this.c) {
            case 0:
               if (this.b.R() <= 32) {
                  this.f = this.b.Z().a().a("bg1");
                  this.f = Color.a(255, (Color)this.f);
               } else if (this.b.R() <= 40) {
                  this.f = this.b.Z().a().a("lt1");
                  this.f = Color.a(255, (Color)this.f);
               } else {
                  this.f = var1;
                  this.f = Color.a(255, (Color)this.f);
               }
               break;
            case 1:
               if (this.b.aa()) {
                  this.g = 0;
               } else {
                  this.c(true);
               }
            case 2:
            case 5:
            case 6:
            case 7:
            case 8:
            case 9:
            case 10:
            case 11:
            case 12:
            case 13:
            case 16:
            default:
               break;
            case 3:
            case 4:
               this.c(false);
               break;
            case 14:
               if (this.b.R() == 1) {
                  this.f = this.b.Z().a().a(var1, 0.25D);
                  this.f = Color.a(255, (Color)this.f);
               } else if (this.b.R() == 2) {
                  this.f = this.b.Z().a().a(var1, 0.05D);
                  this.f = Color.a(255, (Color)this.f);
               } else if (this.b.R() <= 8) {
                  var2 = this.b.R() - 2;
                  this.f = this.b.Z().a().a("accent" + var2);
                  this.f = this.b.Z().a().a(this.f, 0.25D);
                  this.f = Color.a(255, (Color)this.f);
               } else if (this.b.R() == 9) {
                  this.f = this.b.Z().a().a(var1, 0.25D);
                  this.f = Color.a(255, (Color)this.f);
               } else if (this.b.R() == 10) {
                  this.f = this.b.Z().a().a(var1, 0.05D);
                  this.f = Color.a(255, (Color)this.f);
               } else if (this.b.R() <= 16) {
                  var2 = this.b.R() - 10;
                  this.f = this.b.Z().a().a("accent" + var2);
                  this.f = this.b.Z().a().a(this.f, 0.25D);
                  this.f = Color.a(255, (Color)this.f);
               } else if (this.b.R() == 17) {
                  this.f = this.b.Z().a().a(var1, 0.25D);
                  this.f = Color.a(255, (Color)this.f);
               } else if (this.b.R() == 18) {
                  this.f = this.b.Z().a().a(var1, 0.05D);
                  this.f = Color.a(255, (Color)this.f);
               } else if (this.b.R() <= 24) {
                  var2 = this.b.R() - 18;
                  this.f = this.b.Z().a().a("accent" + var2);
                  this.f = this.b.Z().a().a(this.f, 0.25D);
                  this.f = Color.a(255, (Color)this.f);
               } else if (this.b.R() == 25) {
                  this.f = this.b.Z().a().a(var1, 0.25D);
                  this.f = Color.a(255, (Color)this.f);
               } else if (this.b.R() == 26) {
                  this.f = this.b.Z().a().a(var1, 0.05D);
                  this.f = Color.a(255, (Color)this.f);
               } else if (this.b.R() <= 32) {
                  var2 = this.b.R() - 26;
                  this.f = this.b.Z().a().a("accent" + var2);
                  this.f = this.b.Z().a().a(this.f, 0.25D);
                  this.f = Color.a(255, (Color)this.f);
               } else if (this.b.R() <= 40) {
                  this.f = this.b.Z().a().a("lt1");
                  this.f = Color.a(255, (Color)this.f);
               } else if (this.b.R() == 41) {
                  this.f = this.b.Z().a().a(var1, 0.25D);
                  this.f = Color.a(255, (Color)this.f);
               } else if (this.b.R() == 42) {
                  this.f = this.b.Z().a().a("lt1");
                  this.f = Color.a(255, (Color)this.f);
               } else if (this.b.R() <= 48) {
                  var2 = this.b.R() - 42;
                  this.f = this.b.Z().a().a("accent" + var2);
                  this.f = this.b.Z().a().a(this.f, 0.25D);
                  this.f = Color.a(255, (Color)this.f);
               }
               break;
            case 15:
               if (this.b.R() == 1) {
                  this.f = this.b.Z().a().a(var1, 0.85D);
                  this.f = Color.a(255, (Color)this.f);
               } else if (this.b.R() == 2) {
                  this.f = this.b.Z().a().a(var1, 0.95D);
                  this.f = Color.a(255, (Color)this.f);
               } else if (this.b.R() <= 8) {
                  var2 = this.b.R() - 2;
                  this.f = this.b.Z().a().a("accent" + var2);
                  this.f = this.b.Z().a().b(this.f, 0.25D);
                  this.f = Color.a(255, (Color)this.f);
               } else if (this.b.R() == 9) {
                  this.f = this.b.Z().a().a(var1, 0.85D);
                  this.f = Color.a(255, (Color)this.f);
               } else if (this.b.R() == 10) {
                  this.f = this.b.Z().a().a(var1, 0.95D);
                  this.f = Color.a(255, (Color)this.f);
               } else if (this.b.R() <= 16) {
                  var2 = this.b.R() - 10;
                  this.f = this.b.Z().a().a("accent" + var2);
                  this.f = this.b.Z().a().b(this.f, 0.25D);
                  this.f = Color.a(255, (Color)this.f);
               } else if (this.b.R() == 17) {
                  this.f = this.b.Z().a().a(var1, 0.85D);
                  this.f = Color.a(255, (Color)this.f);
               } else if (this.b.R() == 18) {
                  this.f = this.b.Z().a().a(var1, 0.95D);
                  this.f = Color.a(255, (Color)this.f);
               } else if (this.b.R() <= 24) {
                  var2 = this.b.R() - 18;
                  this.f = this.b.Z().a().a("accent" + var2);
                  this.f = this.b.Z().a().b(this.f, 0.25D);
                  this.f = Color.a(255, (Color)this.f);
               } else if (this.b.R() == 25) {
                  this.f = this.b.Z().a().a(var1, 0.85D);
                  this.f = Color.a(255, (Color)this.f);
               } else if (this.b.R() == 26) {
                  this.f = this.b.Z().a().a(var1, 0.95D);
                  this.f = Color.a(255, (Color)this.f);
               } else if (this.b.R() <= 32) {
                  var2 = this.b.R() - 26;
                  this.f = this.b.Z().a().a("accent" + var2);
                  this.f = this.b.Z().a().b(this.f, 0.25D);
                  this.f = Color.a(255, (Color)this.f);
               } else if (this.b.R() == 33) {
                  this.f = this.b.Z().a().a(var1, 0.85D);
                  this.f = Color.a(255, (Color)this.f);
               } else if (this.b.R() == 34) {
                  this.f = this.b.Z().a().a(var1, 0.95D);
                  this.f = Color.a(255, (Color)this.f);
               } else if (this.b.R() <= 40) {
                  var2 = this.b.R() - 34;
                  this.f = this.b.Z().a().a("accent" + var2);
                  this.f = this.b.Z().a().b(this.f, 0.25D);
                  this.f = Color.a(255, (Color)this.f);
               } else if (this.b.R() == 41) {
                  this.f = this.b.Z().a().a(var1, 0.85D);
                  this.f = Color.a(255, (Color)this.f);
               } else if (this.b.R() == 42) {
                  this.f = var1;
                  this.f = Color.a(255, (Color)this.f);
               } else if (this.b.R() <= 48) {
                  var2 = this.b.R() - 42;
                  this.f = this.b.Z().a().a("accent" + var2);
                  this.f = this.b.Z().a().b(this.f, 0.25D);
                  this.f = Color.a(255, (Color)this.f);
               }
            }

            this.j = false;
         }
      }
   }

   private void c(boolean var1) {
      if (this.b.R() <= 32) {
         if (var1) {
            this.f = this.b.Z().a().a("bg1");
            this.f = Color.a(255, (Color)this.f);
         }
      } else if (this.b.R() <= 34) {
         this.f = this.b.Z().a().a("dk1");
         this.f = this.b.Z().a().a(this.f, 0.2D);
         this.f = Color.a(255, (Color)this.f);
      } else if (this.b.R() <= 40) {
         int var2 = this.b.R() - 34;
         this.f = this.b.Z().a().a("accent" + var2);
         this.f = this.b.Z().a().a(this.f, 0.2D);
         this.f = Color.a(255, (Color)this.f);
      } else {
         this.f = this.b.Z().a().a("dk1");
         this.f = this.b.Z().a().a(this.f, 0.95D);
         this.f = Color.a(255, (Color)this.f);
      }

   }

   void a(com.aspose.cells.b.a.b.zp var1) {
      this.a(new com.aspose.cells.b.a.b.zq((float)var1.c(), (float)var1.d(), (float)var1.e(), (float)var1.f()));
   }

   void a(com.aspose.cells.b.a.b.zq var1) {
      com.aspose.cells.b.a.b.a.ze var2 = new com.aspose.cells.b.a.b.a.ze();
      var2.b(var1);
      this.a(var2, 1.0F);
   }

   void a(com.aspose.cells.b.a.b.a.ze var1) {
      this.a(var1, 1.0F);
   }

   void a(com.aspose.cells.b.a.b.a.ze var1, float var2) {
      this.a(var1, var2, var1);
   }

   void a(com.aspose.cells.b.a.b.a.ze var1, float var2, com.aspose.cells.b.a.b.a.ze var3) {
      if (this.h() != 0 && var1 != null && var3 != null) {
         com.aspose.cells.b.a.b.zc var4 = this.b(var3, var2);
         zn var5 = this.b.ap();
         var5.a(var4, var1);
         this.a(var4);
      }
   }

   com.aspose.cells.b.a.b.zc b(com.aspose.cells.b.a.b.a.ze var1) {
      return this.b(var1, 1.0F);
   }

   com.aspose.cells.b.a.b.zc b(com.aspose.cells.b.a.b.a.ze var1, float var2) {
      this.j();
      boolean var3 = this.k();
      Object var4 = null;
      if (this.g()) {
         var4 = this.e.a(var1, var3, var2);
      } else {
         Color var5 = this.f;
         if (var3) {
            var5 = this.d;
         }

         var4 = new com.aspose.cells.b.a.b.zu(Color.fromArgb(var5.getA() & 255, (int)((float)(var5.getR() & 255) * var2), (int)((float)(var5.getG() & 255) * var2), (int)((float)(var5.getB() & 255) * var2)));
      }

      return (com.aspose.cells.b.a.b.zc)var4;
   }

   private void a(com.aspose.cells.b.a.b.zc var1) {
      if (this.g()) {
         this.e.a(var1);
      } else {
         var1.h();
      }

   }

   boolean k() {
      boolean var1 = false;
      zje var2;
      if (this.c == 7 && !this.a) {
         var2 = (zje)this.i;
         if (this.b(var2.g().a().m()) && this.b() && var2.F()) {
            var1 = true;
         }
      } else if (this.c == 7 && this.a) {
         var2 = (zje)this.i;
         if (this.b(var2.g().a().m()) && var2.g().a().A().b() && var2.F()) {
            var1 = true;
         }
      }

      return var1;
   }

   private boolean b(int var1) {
      switch(var1) {
      case 6:
      case 7:
      case 8:
      case 9:
      case 10:
      case 11:
      case 14:
      case 15:
      case 16:
      case 17:
      case 18:
      case 19:
      case 20:
      case 21:
      case 22:
      case 23:
      case 24:
      case 25:
      case 26:
      case 27:
      case 28:
      case 29:
      case 30:
      case 31:
      case 32:
      case 33:
      case 34:
      case 50:
      case 51:
      case 52:
      case 53:
      case 54:
      case 55:
      case 56:
         return true;
      case 12:
      case 13:
      case 35:
      case 36:
      case 37:
      case 38:
      case 39:
      case 40:
      case 41:
      case 42:
      case 43:
      case 44:
      case 45:
      case 46:
      case 47:
      case 48:
      case 49:
      default:
         return false;
      }
   }

   protected void finalize() throws Exception {
      this.b(false);
   }

   public void l() {
      this.b(true);
      com.aspose.cells.b.a.zg.a(this);
   }

   protected void b(boolean var1) {
      if (!this.k) {
         if (var1 && this.e != null) {
            this.e.g();
         }

         this.k = true;
      }

   }
}
